import $ from 'jquery'
/**
 * @description 创建支付弹层
 */
export function Public() {

    this.src = ''
    this.flag = false
    this.width = 452
    this.height = 420
}
Public.prototype = {
    init: function() {
        this.template()
    },
    //关闭浮层
    _closePublicModel: function() {
        $('.publicModel').css('display', 'none')
        $('#iframeId').attr('src', '')
        this.flag = false
    },
    template: function() {
        var html = ''
        html += '<div class="publicModel"  style="position:fixed;top:0px;left:0px;right:0px;bottom:0px;background:rgba(0,0,0,0.5);z-index:1000;">'
        html += '<div style="width:' + this.width + 'px;height:' + this.height + 'px;position:absolute;top:50%;left:50%;margin-left:-' + this.width / 2 + 'px;margin-top:-' + this.height / 2 + 'px;">'
        html += '<i id="closeBtnPublic" style="position:absolute;top:6px;right:7px;width:20px;height:18px;line-height:18px;text-algin;center;display:block;font-size:22px;cursor:pointer;color:#fff;    text-align: center;"> ×</i>'
        if (this.flag == false) {
            html += '<i  style="position: absolute;top: 123px;right: 0px;width: 80px;height: 20px;line-height: 20px;display: block;left: 50%; margin-left: -154px;text-align: center;color: #FF2424; font-size: 14px;font-weight: bold;"> </i>'
        } else if (this.flag == true) {
            html += '<i  style="position: absolute;top: 123px;right: 0px;width: 80px;height: 20px;line-height: 20px;display: block;left: 50%; margin-left: -154px;text-align: center;color: #FF2424; font-size: 14px;font-weight: bold;"> </i>'

        }

        html += ' <iframe frameborder="0" id="iframeId" style="width:' + this.width + 'px;height:' + this.height + 'px;" src=' + this.src + ' >'
        html += +' </div>'
        html += +' </div>'
        $('body').append(html)
    }

}